from sqlalchemy import Column, Integer, String, Boolean, DateTime, func
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class KylinFutureTradeCal(Base):
    """
    期货交易日历表
    """
    __tablename__ = "kylin_future_trade_cal"

    id = Column(Integer, primary_key=True, autoincrement=True, comment='主键')
    cal_date = Column(String(8), unique=True, nullable=False, comment='日历日期')
    is_open = Column(Boolean, nullable=False, default=True, comment='是否交易 0休市 1交易')
    pretrade_date = Column(String(8), nullable=True, comment='上一个交易日')
    create_time = Column(DateTime, server_default=func.now(), comment='创建时间')
    update_time = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment='更新时间')